package com.kefu.robot.vo;

import javax.validation.constraints.Size;

import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.robot.model.RobotSynonym;

import cn.hutool.core.util.IdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "同义词")
public class RobotSynonymInsertVo extends AbstractInsertVo<RobotSynonym> {

    @Size(max = 32)
    @ApiModelProperty(name = "title", value = "标准词")
    private String title;
    @Size(max = 1024)
    @ApiModelProperty(name = "question", value = "同义词，逗号分隔")
    private String question;

    @Override
    public RobotSynonym convert() {

        RobotSynonym info = new RobotSynonym();

        info.setTitle(title);
        info.setQuestion(question);

        KefuContext context = KefuContext.getKefuContext();

        info.setId(IdUtil.simpleUUID());

        info.setTenantId(context.getTenantId());
        info.setCreateUser(context.getUserId());
        info.setCreateTime(context.getNow());
        info.setUpdateUser(context.getUserId());
        info.setUpdateTime(context.getNow());

        return info;
    }

}